package com.lk.oauth2.web.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lk.oauth2.web.entity.SysPermission;
import com.lk.oauth2.web.mapper.SysPermissionMapper;
import com.lk.oauth2.web.service.SysPermissionService;

import org.springframework.stereotype.Service;

/**
 * 权限表 服务实现类
 *
 * @author Aspirin
 * @since 2020-06-21
 */
@Service
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission>
    implements SysPermissionService {

  @Override
  public List<SysPermission> findByUserId(Long userId) {
    if (userId == null) {
      return null;
    }
    List<SysPermission> permissionList = baseMapper.selectPermissionByUserId(userId);
    //   permissionList.remove(null); 如果没有权限，则将集合中的数据null移除
    return permissionList;
  }
}
